import React from 'react'
import { useSelector, useDispatch } from 'react-redux'
import { addMoney, updateUserInfo } from '../../redux/slices/userSlice'
export default function Test2() {
  const dispatch = useDispatch()
  const money = useSelector(state => state.userInfo.money)
  const age = useSelector(state => state.userInfo.age)
  return (
    <div>
      <div onClick={() => { dispatch(addMoney()) }}>
        Test2:money:{money}
      </div>
      <div onClick={() => { dispatch(updateUserInfo({ key: 'age', value: 666 })) }}>
        age:{age}
      </div>
    </div>
  )
}
